/*
 * @Description: 描述信息
 * @Version: 版本号
 * @Author: xuebao
 * @Date: 2023-12-10 15:51:07
 * @LastEditors: xuebao
 * @LastEditTime: 2023-12-14 19:20:28
 */
import React from 'react'
import { createBrowserRouter, Navigate } from 'react-router-dom'
import AuthLoader from './AuthLoader'
import Welcome from '@/views/Welcome/Welcome'
import Error404 from '@/views/Error404'
import Error403 from '@/views/Error403'
import Login from '@/views/Login/Login'
import Layout from '@/layout/index'
import { lazyLoad } from './LazyLoad'
// import DashBoard from '@/views/dashboard'
// import User from '@/views/system/UserList'
// import Dept from '@/views/dept'
// import Menu from '@/views/menu/index'
// import Role from '@/views/role'
// import OrderList from '@/views/order/OrderList'
// import OrderCluster from '@/views/order/OrderCluster'
// import DriverList from '@/views/order/DriverList'
// import { lazyLoad } from './LazyLoad'
// const DashBoard = React.lazy(() => import('@/views/dashboard'))
export const router = [
  {
    path: '/',
    element: <Navigate to='/welcome'></Navigate>,
  },

  {
    element: <Layout />,
    id: 'layout',
    loader: AuthLoader,
    children: [
      {
        path: '/welcome',
        element: <Welcome />,
      },
      {
        path: '/dashBoard',
        element: lazyLoad(React.lazy(() => import('@/views/dashboard'))),
      },
      {
        path: '/userList',
        element: lazyLoad(React.lazy(() => import('@/views/system/UserList'))),
      },
      {
        path: '/deptList',
        element: lazyLoad(React.lazy(() => import('@/views/dept'))),
      },
      {
        path: '/menuList',
        element: lazyLoad(React.lazy(() => import('@/views/menu/index'))),
        // meta: {
        //   auth: false,
        // },//测试功能
      },
      {
        path: '/roleList',
        element: lazyLoad(React.lazy(() => import('@/views/role/index'))),
      },
      {
        path: '/orderList',
        element: lazyLoad(React.lazy(() => import('@/views/order/OrderList/index'))),
      },
      {
        path: '/cluster',
        element: lazyLoad(React.lazy(() => import('@/views/order/OrderCluster/index'))),
      },
      {
        path: '/driverList',
        element: lazyLoad(React.lazy(() => import('@/views/order/DriverList/index'))),
      },
    ],
  },
  {
    path: '/login',
    element: <Login />,
  },
  {
    path: '*',
    element: <Navigate to='/404' />,
  },
  {
    path: '/404',
    element: <Error404 />,
  },
  {
    path: '/403',
    element: <Error403 />,
  },
]

// export default function Router() {
//   return useRoutes(router)
// }
export default createBrowserRouter(router)
